home *** CD-ROM | disk | FTP | other *** search
/ Network Supervisor's Toolkit / Network Supervisor's Toolkit.iso / tools / nwtp06 / uspace.pas < prev    next >
Pascal/Delphi Source File  |  1996-07-10  |  3KB  |  101 lines

  1. {$X+,B-,V-} {essential compiler directives}
  2.  
  3. program uspace;
  4.  
  5. { Example for the nwFile unit / NwTP 0.6 API. (c) 1993,1995, R.Spronk }
  6.  
  7. { Purpose: A quick way of telling how much space each of your users is
  8.            taking up. For Novell 3.x networks.
  9.  
  10.  
  11. (3867)  Tue 29 Mar 94 19:01
  12. By: Richard Jary
  13. To: All
  14. Re: Disk Space by Login Name
  15. St:
  16. ------------------------------------------------------------
  17. After a quick way of telling how much space each of our users is
  18. taking up. Novell 3.11 system, same info as you get by SYSCON ->
  19. UserInfo -> Volume/Disk Restrictions. But preferably for all
  20. users in a text file format, rather than one by one.
  21.  
  22. Reason - we have a shared area with many directories. All with
  23. fun names like CAMBODIA, where any one of 10 people could be
  24. saving stuff. I'd like to go the the (l)users and say "OI! -
  25. You've got 40MB of stuff on this server - Clean It Up!" sort
  26. of thing. Either more or less polite depending on the user
  27. involved!
  28.  
  29. Richard
  30. Internet: rjary@nibueng.ccdn.otc.com.au
  31.  
  32. --- msgedsq 2.1a
  33.  * Origin: Networking from Narara. (3:711/445) }
  34.  
  35.  
  36. Uses nwMisc,nwBindry,nwFile;
  37.  
  38. Var lastObjSeen  : Longint;
  39.     RepName      : String;
  40.     RepType      : Word;
  41.     RepId        : LongInt;
  42.     RepFlag      : Byte;
  43.     RepSecurity  : Byte;
  44.     RepHasProperties: Boolean;
  45.     FullUserName : string;
  46.     MaxAllowedBlocks,BlocksInUse:Longint;
  47.     VolumeNbr    : Byte;
  48.     VolUsageInfo : TvolUsage;
  49.     Version      : Word;
  50.  
  51.     VolInfo:array[0..31] of record
  52.                             Name           :string;
  53.                             SectorsPerBlock:Byte;
  54.                             end;
  55.  
  56. begin
  57. If NOT IsShellLoaded
  58.  then begin
  59.       writeln('USPACE requires:');
  60.       writeln('  -The shell to be loaded;');
  61.       halt(1);
  62.       end;
  63.  
  64. GetNWversion(version);
  65. if version<300
  66.  then begin
  67.       writeln('Netware 3.x only.');
  68.       halt(1);
  69.       end;
  70.  
  71. for VolumeNbr:=0 to 31
  72.  do begin
  73.     IF GetVolumeName(VolumeNbr,VolInfo[VolumeNbr].name)
  74.        and GetVolumeUsage(VolumeNbr,VolUsageInfo)
  75.      then VolInfo[VolumeNbr].SectorsPerBlock:=VolUsageInfo.SectorsPerBlock;
  76.     end;
  77.  
  78. lastObjSeen:=-1;
  79. While ScanBinderyObject('*',OT_USER,
  80.                         lastObjSeen,
  81.                         RepName,RepType,RepId,RepFlag,RepSecurity,RepHasProperties)
  82.  do begin
  83.     GetRealUserName(RepName,FullUserName);
  84.     writeln(Repname+' ('+FullUserName+')');
  85.  
  86.     For VolumeNbr:=0 to 31
  87.      do if GetObjectVolRestriction(VolumeNbr,RepId,MaxAllowedBlocks,BlocksInUse)
  88.          then begin
  89.               write('     ',volInfo[VolumeNbr].Name,' :',
  90.                     BlocksInUse*(VolInfo[VolumeNbr].SectorsPerBlock DIV 2),' Kb.');
  91.               if MaxAllowedBlocks=$40000000
  92.                then writeln
  93.                else writeln('  Restriction: ',MaxAllowedBlocks*4,' Kb.');
  94.               end;
  95.     end;
  96. if nwBindry.Result=$FC { NO_SUCH_OBJECT, indicates end of search }
  97.  then writeln('')
  98.  else writeln('error scanning bindery:',HexStr( nwBindry.Result,2));
  99.  
  100. end.
  101.